import matplotlib.pyplot as plt
city = ["Beijing","Shanghai","Guangzhou","Shenzhen"]
gdp = [2233,2433,5233,4233]

# 柱状图
plt.pie(gdp, labels=city, autopct='%1.1f%%')
'''
autopct 显示百分比, %1.1f%% 保留一位小数
'''

# 设置全局字体
plt.rcParams['font.sans-serif'] = ['SimHei']  # 使用黑体
plt.rcParams['axes.unicode_minus'] = False  # 解决负号显示问题
plt.title("中国各城市GDP占比")
plt.show()